package com.acwing.partition45;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/5/23 16:09
 */
public class AC4441谎牛计数_枚举 {

    private static final int N = 1010;
    private static int[] p = new int[N];
    private static char[] opt = new char[N];
    private static int n;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        int ans = n;
        for (int i = 0; i < n; i++) {
            opt[i] = next().charAt(0);
            p[i] = nextInt();
        }
        for (int i = 0; i < n; i++) ans = Math.min(ans, resolve(p[i]));
        writer.println(ans);
        writer.flush();
    }

    private static int resolve(int pos) {
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (opt[i] == 'G' && p[i] > pos) cnt++;
            else if (opt[i] == 'L' && p[i] < pos) cnt++;
        }
        return cnt;
    }

    private static String next() throws IOException {
        tokenizer.nextToken();
        return tokenizer.sval;
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
